<?php $this->load->view('header');?>

<body class="childrenBody custom_body">
	<div class="custom_main">
		<fieldset class="layui-elem-field layui-field-title">
		  <legend>卡片信息</legend>
		</fieldset>

		<form class="layui-form">
			<div class="layui-form-item">
				<label class="layui-form-label custom_i"><i>*</i> 名称：</label>
				<div class="layui-input-inline">
					<input type="text" name="card_name" required lay-verify="required" placeholder="请输入名称" autocomplete="off" class="layui-input" value="<?=$card_name?>">
				</div> 
			</div>

			<div class="layui-form-item">
				<label class="layui-form-label custom_i"><i>*</i> 价格：</label>
				<div class="layui-input-inline">
					<input type="text" name="price" required lay-verify="required" placeholder="只可输入数字" autocomplete="off" class="layui-input" value="<?=$price?>">
				</div> 
			</div>

			<div class="layui-form-item">
				<label class="layui-form-label custom_i"><i>*</i> 次数：</label>
				<div class="layui-input-inline">
					<input type="text" name="course_num" required lay-verify="required" placeholder="只可输入数字" autocomplete="off" class="layui-input" value="<?=$course_num?>">
				</div> 
			</div>

			
			<div class="layui-form-item">
				<label class="layui-form-label">简介描述：</label>
			    <div class="layui-input-block">
			      <textarea name="brief" placeholder="请输入简介" class="layui-textarea"><?=$brief?></textarea>
			    </div>
			</div>

			<div class="layui-form-item">
				<div class="layui-input-block">
					<input type="hidden" name="card_id" value="<?=$card_id?>" />
					<input type="hidden" name="course_id" value="<?=$course_id?>">
					<button class="layui-btn layui-btn-normal" lay-submit="" lay-filter="addUser">确 认</button>
					<button type="reset" class="layui-btn layui-btn-primary">重 置</button>
			    </div>
			</div>
		</form>
		
	</div>

	<script type="text/javascript">
		layui.config({
			version: true
		}).use(['jquery','layer', 'form', 'laytpl', 'upload'],function(){
			var form = layui.form,
				layer = parent.layer === undefined ? layui.layer : parent.layer,
				laypage = layui.laypage,
				laytpl = layui.laytpl,
				upload = layui.upload,
				$ = layui.jquery;

				//提交表单
				form.on("submit(addUser)",function(data)
				{
					$.post('admin.php/CourseCard/insert_add_card', data.field, function(result) {
						if (result.status == 200) 
						{
							var index=parent.layer.getFrameIndex(window.name);
							parent.layer.close(index);
							layer.msg(result.message, {icon: 1});
							parent.location.reload();
						}
						else
						{
							layer.msg(result.message, {icon: 5});
						}

					},"json");

					return false;
				});

				form.render(); //更新全部

		});

	</script>

</body>
</html>